<template>
  <div>
    <div v-for="(v,i) in newtext" :key="i" >
    <div class="Sticky">
      <a href="">
        <div class="header">
          <div class="content">
            <h2 class="title">{{v.Dtitle}}</h2>
          </div>
          <div class="detail">
            {{v.datail}}
            <svg
              viewBox="0 0 24 24"
              fill="none"
              stroke="currentColor"
              stroke-width="2"
              stroke-linecap="round"
              stroke-linejoin="round"
              xmlns="http://www.w3.org/2000/svg"
              class="Icon"
              style="margin-right: -4px"
            >
              <polyline points="9 18 15 12 9 6"></polyline>
            </svg>
          </div>
        </div>
      </a>
    </div>

    <!-- 编写书籍推荐栏开始 -->
    <div class="root" v-for="(n,j) in v.root" :key="j">
      <div class="wrap">
        <div class="img">
          <div
            class="jsx-1947202380"
            :style="n.bgimg"
          ></div>
        </div>
        <div class="contenter">
          <div class="content-top">
            <div class="content-left">
              <h3 class="title">{{n.title}}</h3>
              <div class="meta">{{n.name}}</div>
              <div class="little">
                <span class="ratin">{{n.ratin}}</span>
              </div>
            </div>
          </div>
          <div class="bottom">
            <div class="bookPrice">
              <span class="price">{{n.price}}</span>
              <div class="discount-wrap">
                <span class="label">{{n.label}}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 编写书籍推荐栏结束 -->
    <div class="langaodu">
      <div class="jsx-2350840964 feed-footer category">
      再多来点儿<svg
        viewBox="0 0 24 24"
        fill="none"
        stroke="currentColor"
        stroke-width="2"
        stroke-linecap="round"
        stroke-linejoin="round"
        xmlns="http://www.w3.org/2000/svg"
        class="Icon"
        width="20"
        height="20"
        style="margin-left: 5px"
      >
        <polyline points="6 9 12 15 18 9"></polyline>
      </svg>
    </div>
    </div>
  </div>
  </div>
</template>

<script>
export default {
   // 设置钩子函数 调用actions触发异步请求 触发actions的RECOMMEND方法
  mounted(){
        this.$store.dispatch("RECOMMEND");
  },
  computed:{
    // 从vuex中取出数据
    newtext(){
      return  this.$store.state.homeRecommend.data
    }
  }
};
</script>

<style scoped>
a {
  color: inherit;
  text-decoration: none;
}
.Sticky {
  width: 100%;
  height: 0.52rem;
}
.header {
  display: flex;
  flex-direction: row;
  -webkit-box-align: center;
  align-items: center;
  padding: 15px;
  background: rgb(255, 255, 255);
}
.content {
  -webkit-box-flex: 1;
  flex-grow: 1;
}
.title {
  font-size: 20px;
  font-weight: 500;
  line-height: 1.1;
}
.detail {
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  color: rgb(170, 170, 170);
  flex-shrink: 0;
  font-size: 13px;
}
svg:not(:root) {
  overflow: hidden;
}
.Icon {
  width: 1.4em;
  vertical-align: -0.3em;
}
:not(svg) {
  transform-origin: 0px 0px;
}

/* 编写书籍推荐栏开始 */

.wrap {
  width: 100%;
  height: 1.56rem;
  display: flex;
  padding: 0.18rem 0.15rem;
  color: inherit;
}
.root {
  position: relative;
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  -webkit-box-pack: center;
  justify-content: center;
  flex-shrink: 0;
  width: 100%;
  height: 156px;
}
.img {
  width: 0.8rem;
  height: 1.2rem;
  box-sizing: border-box;
  box-shadow: rgb(0 0 0 / 10%) 0px 0px 8px 0px;
}
.jsx-1947202380 {
  width: 100%;
  height: 100%;
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
}
.contenter {
  -webkit-box-flex: 1;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  margin-left: 12px;
}
.content-top {
  margin-bottom: 30px;
  display: flex;
}
.content-left {
  -webkit-box-flex: 1;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  word-break: break-word;
}
.title {
  margin: -0.1em 0px 0px;
  font-size: 16px;
  font-weight: 500;
}
.meta {
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  margin-top: 4px;
  color: rgb(170, 170, 170);
  font-size: 12px;
}
.little {
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  margin-top: 5px;
  color: rgb(102, 102, 102);
  font-size: 12px;
}
.ratin {
  color: rgb(214, 186, 140);
  font-size: 12px;
}
.bottom {
  display: flex;
  -webkit-box-align: center;
  align-items: center;
  margin-top: 5px;
  flex-wrap: wrap;
}
.bookPrice {
  display: flex;
  -webkit-box-align: center;
  align-items: center;
}
.bookPrice .price {
  font-size: 18px;
}
.discount-wrap {
  line-height: 0;
}
.label {
  box-sizing: border-box;
  /* display: -webkit-inline-flex; */
  display: inline-flex;
  /* -webkit-align-items: center; */
  align-items: center;
  height: 18px;
  padding: 0 6px;
  color: rgb(214, 186, 140);
  font-size: 12px;
  font-weight: 400;
  border: 1px solid rgb(214, 186, 140);
  border-radius: 4px;
  white-space: nowrap;
  margin-left: 5px;
}
/* 编写书籍推荐栏结束 */

.feed-footer.jsx-2350840964 {
    padding: 16px 0px;
    border-top: 0.5px solid rgb(242, 242, 242);
    background: rgb(255, 255, 255);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}
svg:not(:root) {
    overflow: hidden;
}
.Icon {
    width: 1.4em;
    vertical-align: -0.3em;
}
.langaodu{
  background-color: #f2f2f2;
    height: 70px;
}
</style>